package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindOperation implements Ioperation
{
    @Override
    public void work(BookList bookList) {
        System.out.println("查找图书..............");
        System.out.println("请输入要查找的书名......");
        Scanner sc=new Scanner(System.in);
        String bookname=sc.nextLine();
        int currentsize=bookList.getUseSize();
        for(int i=0;i<currentsize;i++){
            Book book=bookList.getbook(i);
            if(book.getName().equals(bookname)){
                System.out.println("找到了");
                System.out.println(book);
            }
        }
        System.out.println("没有找到你需要的图书");

    }
}
